#ifndef TEXT_TO_PCM_H
#define TEXT_TO_PCM_H

#include <string>

#include <fstream>
#include <filesystem>
#include <vector>
#include <mutex>
#include <condition_variable>

#include <gio/gio.h>
#include <gio/giotypes.h>
#include <genai/text/chat.h>
#include <coreai/speech/synthesizer.h>


using namespace std;

class TextToPcm
{

public:
    TextToPcm();
    ~TextToPcm();

    string run_model(string input_text);

    static void write_binary_data_to_file(std::string file_name, std::vector<char> &data);

    static void model_callback(SpeechSynthesisResult *result, void *user_data);

public:
    AudioConfig *synthesizer_config;
    SpeechSynthesizerSession *session;
    SpeechModelConfig *model_config;

    std::mutex sync_mutex;
    std::condition_variable cv;
    bool reply_ready = false;
};

#endif